<%-- 
    Document   : home
    Created on : Apr 3, 2012, 1:53:22 AM
    Author     : Mr. Hung
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon" media="all" />
        <link href="style.css" rel="stylesheet" type="text/css" />
        <title>Home</title>
    </head>
    <body>
        <c:import url="/header.jsp"/>
        <c:import url="/leftbar.jsp"/>

        <div id="wrapper">
            <div id="content_wrapper"><span class="top"></span><span class="bottom"></span>
                <div id="content">
                    <table cellspacing="5">
                        <tr>
                            <td colspan="3">
                                <div class="welcome_stt_box">
                                    <form action="WriteStatus" method="post">
                                        <textarea class="write_stt" name="status" rows="3" cols="90" placeholder="New status..." maxlength="200"></textarea>
                                        <input class="btn" type="button" value="Submit" onclick="validate(this.form)">
                                    </form>
                                    <br>
                                </div>

                            </td>
                        </tr>

                        <%-- Display new status from friends and the user --%>

                        <c:if test="${fn:length(statusSet) > 0}" >        
                            <h3>New feeds:</h3>
                        </c:if>

                        <c:forEach var="status" items="${statusSet}">
                            <tr>
                                <td valign="top">
                                    <a href="<c:url value="/ViewPersonalInfo">
                                           <c:param name="accountId" value="${status.writerId}"/>
                                       </c:url>">
                                        <img src="${status.writerAcc.avatar}" height="70" width="70">
                                    </a>
                                </td>
                                <td>&nbsp</td>
                                <td>
                                    <textarea style="border: none; outline: none" name="status" rows="4" cols="75" 
                                              readonly="readonly">${status.content}</textarea>
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <a href="<c:url value="/ViewPersonalInfo">
                                           <c:param name="accountId" value="${status.writerId}"/>
                                       </c:url>">${status.writerAcc.username}
                                    </a>
                                </td>
                                <td>&nbsp</td>
                                <td>
                                    <font color="gray"><i>${status.timeAgo}</i></font>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <div class="status_box">
                                        &nbsp
                                    </div>
                                </td>
                            </tr>

                        </c:forEach>
                    </table>

                    <script type="text/javascript">
                        function validate(form) {
                            if (form.status.value == "")  {
                                alert("please input status");
                            } else {
                                form.submit();
                            }
                        }
                    </script>
                </div> <!-- end of content -->

                <%-- import side bar --%>             
                <c:import url="/sidebar.jsp" /> 

                <div class="cleaner"></div>
            </div> <!-- end of content_wrapper -->
        </div>
        <c:import url="/footer.jsp"/>

    </body>
</html>
